drawCloud = class()

function drawCloud:init()
    self.clouds = {}
    self.frame = 0
end

function drawCloud:generateNextCloud()
    cloud = Cloud()
    cloud.position = vec2(-100,math.random(HEIGHT/2-100,HEIGHT))   
    table.insert(self.clouds, cloud)       
end

function drawCloud:cullClouds()
    for i,v in ipairs(self.clouds) do
        v.position.x = v.position.x + 1.75
        if v.position.x > WIDTH + 300 then
            table.remove(self.clouds,i)
        end
    end
end

function drawCloud:update()
    self.frame = (self.frame+1)%128
    if self.frame%128 == 0 then
        self:generateNextCloud()
    end
    self:cullClouds()
end

function drawCloud:draw()
    for i,v in ipairs(self.clouds) do
        v:draw()
    end
end


